﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Actions="clr-namespace:Caliburn.PresentationFramework.Actions;assembly=Caliburn.PresentationFramework" xmlns:Utility="clr-namespace:CI.Utility" xmlns:Models="clr-namespace:CI.Models;assembly=CI.Models" xmlns:Data="clr-namespace:CI.Models.Data;assembly=CI.Models" xmlns:CI="clr-namespace:CI" xmlns:ViewModels="clr-namespace:CI.ViewModels" x:Class="CI.Views.Interfaces.ItemSelectorView"
    xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
    xmlns:cal="http://www.caliburnproject.org"

             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Actions:Action.Target="{Binding}">
	<UserControl.Resources>
        
        <DataTemplate DataType="{x:Type Models:Activity}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" FontSize="14" TextWrapping="Wrap" Text="{Binding Path=., Converter={StaticResource ActivityNameConverter}}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Data:Item}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
				<TextBlock Grid.Column="0" FontSize="14" TextWrapping="Wrap" Text="{Binding TypeName}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type Models:Character}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <!-- -->
                <TextBlock Grid.Column="0" FontSize="14" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type Models:Corporation}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" FontSize="14" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>        
        <DataTemplate DataType="{x:Type ViewModels:Johnny5Character}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" FontSize="14" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Width, Height"/>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Expander Header="{Binding GroupName}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock VerticalAlignment="Center"><Run Text="Search"/></TextBlock>
            <TextBox Grid.Column="1" Text="{Binding FilterByName, UpdateSourceTrigger=PropertyChanged}"/>
            <Button Grid.Column="2" cal:Message.Attach="[Event Click] = [Action ClearFilter()]" Content="X" />
            <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" Height="200" VerticalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" dd:DragDrop.IsDragSource="True" dd:DragDrop.DragAdornerTemplate="{Binding Path=SelectedItem, Converter={StaticResource DragDropAdornerConverter}}"/>
    </Grid>
    </Expander>
</UserControl>
